package com.amat0urheu.dao;


import com.amat0urheu.pojo.CloudPojo.NetWork;
import com.amat0urheu.pojo.CloudPojo.OpenStack;
import org.apache.ibatis.annotations.*;

import java.util.List;

@Mapper
public interface NetWrokMapper {

    @Select("select * from mc_network where openstackIP=#{openstackIP} ")
    List<NetWork> getAllNetworks(String openstackIP);
    @Insert("INSERT INTO mc_network (netWorkId,name, NetWorksubnet,Status,openstackIP,gateWayIP) VALUES (#{netWork.netWorkId},#{netWork.name}, #{netWork.NetWorksubnet},#{netWork.Status},#{netWork.openstackIP},#{netWork.gateWayIP})")
    int insertNetwork(@Param("netWork") NetWork netWork);
    int insertnewAllNetwork(List<NetWork> netWorkList);
   @Delete("delete  from mc_network where  openstackIP=#{openstackIP}")
   int dropNetworks(String openstackIP);

    @Delete("delete  from mc_network where netWorkId=#{netWorkId}")
    int deleteNetWorkBynetWorkId(String netWorkId);
@Select("select  name   from mc_network  where openstackIP=#{openStackIP}  order by rand() limit 1  ")
    String findRanNetWork(String  openStackIP);
}
